﻿using System;
using Creventive.Wpf.ShellFactory.Utility;

namespace Creventive.Wpf.ShellFactory.Modules
{
    /// <summary>
    /// Represents a reference to an application module.
    /// </summary>
    public class ModuleReference : Sealable
    {
        private Uri source = null;

        /// <summary>
        /// Gets or sets the URI source for the module.
        /// </summary>
        /// <value>The source.</value>
        public Uri Source
        {
            get { return this.source; }
            set
            {
                this.VerifyUnsealed();
                this.source = value;
            }
        }

        /// <summary>
        /// Called when this object is about to be sealed.
        /// </summary>
        protected override void OnSealing()
        {
            if (this.Source == null)
                throw new InvalidOperationException("Source cannot be null");
            base.OnSealing();
        }
    }
}